Repository navigation
fix(plugin-security): member_default grants sys_comment_reaction read + create, so a stock member can react to comments they can read - #33617
Conversation
… + create A stock member reacts to the comments they can read. No row policy, no edit, no delete bit; external_default unchanged. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn
…'s reaction Pins member_default's reaction grant at the REST doors with a probe that no other held set names reactions; adds the plugin-security changeset. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 18 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 10518249fe0daf63704697606cf6476ddc76f18d && git checkout 10518249fe0daf63704697606cf6476ddc76f18d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 41b64bb08cfe62ebc9dcb3459169daa383406b23 fb45426a1e27984a2ff1ac09c1937ea77a054937 && git checkout -B drift-repro 41b64bb08cfe62ebc9dcb3459169daa383406b23 && git merge --no-ff fb45426a1e27984a2ff1ac09c1937ea77a054937
node scripts/docs-audit/affected-docs.mjs --json 41b64bb08cfe62ebc9dcb3459169daa383406b23
|
|
domain:server#5 · os-elon-musk · session_016WV4cy1y7UNVbT2QAdmgdn Request: review · area E1 · head 799041b · 2026-11-15T03:20Z Verification update: since this PR was opened, the cli unit tier (420/420 files) and the full dogfood battery (467 passed / 3 skipped files, 3954 passed / 42 skipped tests) finished green locally on this head; the body lists them as running / not measured. |
|
Contract-review-claim: session_016WV4cwxS1ZpSu2hAMRcqbt · head 799041b · 2026-11-15T03:21Z |
Review — changes neededHead-sha: must-fix 1: Clause-② is should-fix 2: pin the unfiltered list read. The dogfood cases read the data door only with a Security, checked and sound
VERDICT: changes needed (must-fix 1; should-fix 2). A full contract-review record follows on the fixed head, since this PR is Clause-② yes. |
…nt's reaction Declares Clause-② yes (widening) in the changeset, per review. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn
|
Contract-review-claim: session_016WV4cwxS1ZpSu2hAMRcqbt · head fb45426 · 2026-11-15T03:30Z |
Contract reviewServed-tier: Face: declaration (Clause-② yes, no spec or governed path). Second round: ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
domain:server#5 · os-elon-musk · session_016WV4cy1y7UNVbT2QAdmgdn ACCEPT · area E1 · 2026-11-15T03:32Z
|
Requested by Elon · project thread
Fixes #33584
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
member_default新增一行sys_comment_reaction授权(只读 + 新建,不可编辑、不可删除),普通成员可以对自己能看到的评论点表情回应。external_default不变。回滚 = 删掉这一行。packages/plugins/plugin-security/src/objects/default-permission-sets.ts(新增授权行及注释);②packages/qa/dogfood/test/comment-reactions-and-edit-stamps.dogfood.test.ts(新 describe:仅持基线的成员);③default-permission-sets.test.ts(单元钉子 + 外部用户对照)。pnpm --filter @objectstack/dogfood exec vitest run test/comment-reactions-and-edit-stamps.dogfood.test.ts,预期 9/9 通过;删掉授权行重建 plugin-security 后,新 describe 的 4 条全部转红(POST 返回 403)。What changes
member_defaultgainssys_comment_reaction: { allowRead: true, allowCreate: true, allowEdit: false, allowDelete: false }, placed right after thesys_comment/sys_activitypair, with a comment citing the maintainer decision on plugin-security: member_default grants sys_comment_reaction read + create, so a stock member can react to comments they can read #33584 (option A). No row-level policy is added (the reaction tripwire indefault-permission-sets.test.tsforbids one).external_defaultis untouched.403 RECORD_NOT_ACCESSIBLE) and stampsuser_idfrom the session. Unreact stays the own-row doorDELETE /api/v1/comments/reactions/:id, which removes only a row whosecreated_byis the caller; the baseline carries no delete bit (ADR-0090 D5).comment-reaction-own-record-floor.test.tsno longer calls the grant "an open decision on Comment reactions (ruling A amended on #22505): a reaction is the reactor's ownsys_comment_reactionrecord, andsys_comment.reactionsretires with no aggregate and no data migration #22566": read and create are the baseline's now, and the delete bit on the generic data door still comes from an app's position-distributed set.@objectstack/plugin-securitypatch.Tests
default-permission-sets.test.ts, new top-level describe):member_default's parsedsys_comment_reactionentry equals exactly read + create, with edit, delete, transfer, view-all and modify-all allfalse. CONTROL:external_defaultnames nosys_comment_reactiongrant.comment-reactions-and-edit-stamps.dogfood.test.ts, new top-level describe on the comments fixture with plugin-audit, org-bound). The members hold the app's own read-only baseline composed withmember_default. An arming probe checks that every other set they hold, as the security catalog serves it, names neithersys_comment_reactionnor a wildcard. The four cases:201,user_id= caller) and lists that comment's reactions (both members' rows);200, row gone);403 PERMISSION_DENIED, data door403 PERMISSION_DENIED, row survives;GET /api/v1/data/sys_comment_reactioncontains the member's reaction on the readable comment and omits the admin's reaction on the unreadable one, which still exists.200, emptyrecords), not read by id (404), not removed (404, row survives), and an insert is refused (403 RECORD_NOT_ACCESSIBLE) with nothing stored.Acceptance notes
origin/main4bba8b8f02apart from comments. With the grant ablated, a stock member'sPOST /api/v1/data/sys_comment_reactionanswered403 PERMISSION_DENIED, and so didGET /api/v1/data/sys_comment_reaction?$filter=…. The card's premise holds.sys_activity, not directly undersys_comment, so the existing comment above the pair ("These two lines open the OBJECTS") stays true.comment-reaction-unreact-door.integration.test.tsstill grants reactions through an app every-member set. That grant now duplicatesmember_default's but is harmless, so the file is left as is.sys_comment.reactionscolumn) is console: the record page offers the retired sys_comment.reactions column PATCH to a member refused sys_comment_reaction (400 INVALID_FIELD) #33521.Clause-②: yes (widening), per review: a stock member'sPOST/GET /api/v1/data/sys_comment_reactiongoes from403to201/200, which widens what the data door accepts. The precedents are thesys_userAI-readable change and [Decision] Should an approver be able to see and decide their pending approvals over MCP? #32442.Metadata-protocol: noneand thepatchlevel stay. No published schema or export changes, and no authorable-surface, census or generated baseline moved (see Verification).Verification
Ablation (one, on the grant line), on head df12ab9
node scripts/ablation-replace.mjs --deleteon the grant line (anchor 1 → 0, blobde71003fa3ab→5301afe83779), thenpnpm --filter @objectstack/plugin-security build.ablation-dist-preflight --absent: marker absent from all 6 built files. Results:× member_default carries exactly read + create on sys_comment_reaction(1 failed | 31 passed);×, eachexpected 403 to be 201/expected 403 to be 200, body{"code":"PERMISSION_DENIED","object":"sys_comment_reaction"}; the 5 pre-existing cases stayed green.Restore: blob == HEAD,
git diff HEADempty. Rebuilt plugin-security; preflight: marker present in 2 built files, tree clean.Tests and gates
All local readings below are on head
799041bdf8, onorigin/main4bba8b8f02, which had not moved at the time.pnpm --filter @objectstack/plugin-security test: 266 of 267 files passed on the first run. The one failure was the new unit pin, which had omitted the schema's three materializedfalsebits. After the fix the three reaction files pass (default-permission-sets.test.ts,comment-reaction-own-record-floor.test.ts,comment-reaction-unreact-door.integration.test.ts: 3 files, 44 tests).typecheckexit 0.comment-reactions-and-edit-stamps.dogfood.test.ts: 9/9 passed on799041bdf8. On the review head, which adds the unfiltered-list CONTROL, 10/10 passed. That CONTROL was not ablated: it is a CONTROL, and the grant line's ablation is recorded below.pnpm --filter @objectstack/dogfood typecheck: exit 0.@objectstack/plugin-security, eachpnpm --filter <pkg> test:--project unit, 420 files, 5966 tests, all passed. The integration tier is left to CI.pnpm --filter @objectstack/dogfood test, under the lock, on799041bdf8) passed with exit 0: 467 files passed, 3 skipped; 3954 tests passed, 42 skipped.--no-inline-config) on the 4 touched source files: exit 0.node scripts/check-test-source-alias.mjsnode scripts/check-changeset-no-major.mjs --base origin/maincheck:system-context-censuscheck-tenant-audit-censuscheck:platform-object-tenancy-censuscheck:driver-memory-censuscheck-issue-citationscheck:doc-authoringcheck:nul-bytescheck:cross-package-test-inputscheck:authz-resolvercheck:tier-file-adoptioncheck:closed-ceremony-textcheck-comment-mask-adoptioncheck-comment-mask-corpuscheck-affected-docscheck-drift-commentcheck:engine-double-contractcheck:undeclared-dep-importscheck:published-filespackages/specchange, so there is nothing to regenerate.🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn